﻿using System;

namespace SharpSNS
{
    /// <summary>
    /// Encapsulates functions dealing with the Unix Epoch timestamp
    /// </summary>
    public class Epoch
    {
        /// <summary>
        /// Returns a DateTime instance representing the Unix Epoch
        /// </summary>
        public static DateTime Value
        {
            get { return new DateTime(1970, 1, 1, 0, 0, 0); }
        }

        /// <summary>
        /// Gets the number of seconds elapsed since the Epoch vs the specified value
        /// </summary>
        public static long GetDifference(DateTime value)
        {
            TimeSpan elapsed = value - Epoch.Value;
            return Convert.ToInt64(Math.Floor(elapsed.TotalSeconds));
        }
    }
}
